<?php

class Ms_Model_Forum extends Zend_Db_Table_Abstract
{

    protected $_name = 'forum_forums';
    
    /**
     * 获取某一版块
     *
     * @param int $id
     */
    public function getForum($id){
        $row = $this->find($id)->current();
        if ($row) {
            return $row;
        }
        else{
            return null;
        }
    }
    
    /**
     * 获取版块列表
     *
     * @param int $cat_id
     */
    public function getForums($cat_id = null){
        
        $select = $this->select();
        $select->where('cat_id = ?',$cat_id);
        $forum = $this->fetchAll($select);
        return $forum;
    }
    
}

